import { BaseApi } from "@/api-services/apis/baseApi";
import { SysOrg, ExcelImportResult } from "@/api-services/models/system";
import { BaseIdInput } from "@/api-services/models/baseModels";

/**
 * 菜单管理Api
 */
class SysOrgApi extends BaseApi<SysOrg.SysOrg, SysOrg.OrgAddInput, SysOrg.OrgUpdateInput> {
  //批量导入
  batchImport = async (data: FormData) => {
    return this.normalPost<ExcelImportResult>(`/batchImport`, data);
  };
  //模板下载
  templateDownload = async () => {
    return this.normalGetBlob(`/templateDownload`, null);
  };
  errorFileDownload = async (data: BaseIdInput) => {
    return this.normalGetBlob(`/errorDownload`, data);
  };
  orgSelector = async () => {
    return this.normalGet<Array<SysOrg.OrgSimpleInfo>>("/orgSelector", null);
  };
  //获取组织列表树
  orgTree = async () => {
    return this.normalGet<Array<SysOrg.OrgSimpleInfo>>(`/orgTree`, null);
  };
}

export default new SysOrgApi("/system/org");
